package com.example.springbootmaven.controller;

import com.example.springbootmaven.model.Student;
import com.example.springbootmaven.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/Student")
public class StudentController {
    @Autowired
    StudentService studentService;
    @RequestMapping("list.do")
    public String list(Model model)
    {
        List<Student> students=studentService.findAll();
        model.addAttribute("students",students);
        return "listStudents";
    }
}
